function createElement(tag, classNames) {
	let element = document.createElement(tag);
	element.setAttribute("class", classNames);
	return element;
}

/**
 * dom创建工具，未完成
 * @param {Object} tag
 * @param {Object} {class:"node-title"}
 * @param {Object} c nullable
 */
function h(tag, attributes, c) {
	let e = document.createElement(tag);
	if (typeof(attributes) == 'object') {
		for (let key in attributes) {
			if (key) {
				e.setAttribute(key, attributes[key])
			}
		}
	} else if (typeof(attributes) == 'string') {
		e.setAttribute("class", attributes);
	}
	if (c) {
		if (typeof(c) == 'string') {
			e.innerHTML = c;
		} else {
			if (c.length) {
				for (var i = 0; i < c.length; i++) {
					e.appendChild(c[i]);
				}
			} else {
				e.appendChild(c);
			}
		}
	}
	return e;
}

function span(attributes, child) {
	return h('span', attributes, child);
}

function label(attributes, child) {
	return h('label', attributes, child);
}

function div(attributes, child) {
	return h('div', attributes, child);
}

function img(attributes, child) {
	return h('img', attributes, child);
}

function input(type, attributes, child) {
	let finalAttributes = {};
	if (attributes) {
		if (typeof(attributes) == 'object') {
			finalAttributes = attributes;
		} else {
			finalAttributes['class'] = attributes;
		}
	}
	finalAttributes.type = type;

	return h('input', finalAttributes, child);
}